using System;
using System.Collections.Generic;
using System.Text;
using Entities;
using DAL;

namespace BUS
{
  public   class tbDoanhNghiepBUS
    {
        public static void Insert(tbDoanhNghiep doanhnghiep)
        {
            tbDoanhNghiepDAL doanhnghiepDAL = new tbDoanhNghiepDAL();
            doanhnghiepDAL.Insert(doanhnghiep);

        }
        public static void Uptate(tbDoanhNghiep doanhnghiep)
        {
            tbDoanhNghiepDAL doanhnghiepDAL = new tbDoanhNghiepDAL();
            doanhnghiepDAL.Update (doanhnghiep);

        }
        public static void Delete(int iD)
        {
            tbDoanhNghiepDAL doanhnghiepDAL = new tbDoanhNghiepDAL();
            doanhnghiepDAL.Delete(iD);
        }
        public static tbDoanhNghiepCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbDoanhNghiepDAL doanhnghiepDAL = new tbDoanhNghiepDAL();
            return doanhnghiepDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbDoanhNghiepCollection GetAll()
        {
            int total = 0;
            tbDoanhNghiepDAL doanhnghiepDAL = new tbDoanhNghiepDAL();
            return doanhnghiepDAL.Get("where 1=1", 0, 0,
            tbDoanhNghiepColumns.MaDN .ToString(),
            "ASC", out total);
        }
        public static tbDoanhNghiep GetByID(int iD)
        {
            int total = 0;
            tbDoanhNghiepDAL doanhnghiepDAL = new tbDoanhNghiepDAL();
            tbDoanhNghiepCollection doanhnghiepCollection = doanhnghiepDAL.Get("where " +
            tbDoanhNghiepColumns.MaDN .ToString() + "=" + iD.ToString(),
            0, 0, tbDoanhNghiepColumns.MaDN  .ToString(), "ASC", out total);
            if (doanhnghiepCollection.Count > 0)
                return doanhnghiepCollection[0];
            return null;
        }

    }
}
